<template>
    <div id="news-info">
        <h3 class="title">{{newinfo.title}}</h3>
        <p class="subtitle">
            <span>发表时间：{{newinfo.add_time | dateFormat}}</span>
            <span>点击：{{newinfo.click}}次</span>
            <hr>
            <div class="content">
               <span v-html="newinfo.content"></span>
            </div>
            <comment :id='id'></comment>
        </p>
    </div>
</template>

<script>
import comment from '../subcomponents/comment'
export default {
  name: "news-info",
  data(){
      return{
          id:this.$route.params.id,
          newinfo:{}
      }
  },
  components:{
      comment:comment
  },
  created(){
      this.getNewsInfo()
  },
  methods:{
      getNewsInfo(){
          this.$axios.get('getnew/'+this.id).then((result)=>{
              //console.log(result.data);
              this.newinfo=result.data.message[0]
          })
      }
  }
};
</script>

<style>
#news-info{
    padding: 0 4px
}
#news-info .title{
    font-size: 16px;
    text-align: center;
    margin: 15px 0;
    color: red;
}
#news-info .subtitle{
    font-size: 13px;
    color: #226aff;
    display: flex;
    justify-content:space-between;
}
#news-info .content img{
    width: 100%
}
</style>



